//
//  WH_MyeditViewController.m
//  App_6.23
//
//  Created by wanghao on 16/8/3.
//  Copyright © 2016年 wanghao. All rights reserved.
//

#import "WH_MyeditViewController.h"

@interface WH_MyeditViewController ()
@property (weak, nonatomic) IBOutlet UITextField *nickTF;

@end

@implementation WH_MyeditViewController

-(void)viewWillAppear:(BOOL)animated{
    
    [self.tabBarController.tabBar setHidden:YES];
    
}
-(void)viewWillDisappear:(BOOL)animated{
    
    
    [self.tabBarController.tabBar setHidden:NO];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.view.backgroundColor = [UIColor colorWithRed:0.98 green:0.98 blue:0.98 alpha:1];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"保存" style:UIBarButtonItemStyleDone target:self action:@selector(rightButtonDone)];
    _nickTF.text = _nickStr;
}

-(void)rightButtonDone{
    
    [self alertViewControllerWithTitle:@"确定修改?" content:@"" block:^{
        
        [self postData];
        [self.navigationController popViewControllerAnimated:YES];

    }];
    
}


-(void)postData{
    
    NSString *body = [NSString stringWithFormat:@"action=account_edit&user_id=%@&user_gender=Male&user_nick=%@",NSUSERID,_nickTF.text];
    [WH_AppTools postUrl:URLstr body:body result:HXJSON requestStyle:HXRequestString headerFile:nil success:^(id result) {
        
        NSLog(@"%@",result);
        //NSDictionary *dic = result;
        //NSString *status = [dic objectForKey:@"status"];
        //NSString *message = [dic objectForKey:@"message"];
        
        
    } failure:^(NSError *error) {
        
        
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
